<?php
include 'db.php';
$tutorname=$_GET['t'];
$rating=(int)$_GET['r'];
$sessionid=(int)$_GET['s'];

if(mysql_query("UPDATE login set `ratingcount`=(ratingcount+1),`totalrating`=(totalrating+{$rating}) WHERE `username`='{$tutorname}'"))
	echo "good".PHP_EOL;
else
	echo "bad".PHP_EOL;
if(mysql_query("UPDATE sessions set `rating`={$rating} WHERE sessionid={$sessionid}"))
	echo "good".PHP_EOL;
else
	echo "bad".mysql_error();
mysql_close($link);
?>
